package controllers;

import java.util.ArrayList;
import java.util.List;

import models.Focus;
import utils.exceptions.IdeonException;
import utils.json.data.backbone.FocusJson;
import utils.table.DataTable;
import utils.table.DataTable.DataTablesParameters;

public class BackboneIdeon extends BaseController {
	public static void index() {
		render("backboneIdeon/index.html");
	}

	public static void messages() throws IdeonException {
		ArrayList<MessageTestModel> messages = new ArrayList<MessageTestModel>();
		for(long i = 0; i < 30 ; i++) {
			MessageTestModel message = new MessageTestModel(i, "Titulo de message numero" + i, "Contenido del mensaje numero " +i);
			messages.add(message);
		}
		
		final DataTablesParameters dtp = new DataTable.DataTablesParameters(request);
		
		DataTable<MessageTestModel> table = new DataTable<MessageTestModel>(messages, dtp);
	
		//throw new IdeonException("Esto es un errorrrrrrr!!");
		renderJSON(table);
	}
	
	public static class MessageTestModel {
		public Long id;
		public String title;
		public String content;
		
		public MessageTestModel() {
			this.id = null;
			this.title = "";
			this.content = "";
		}
		
		public MessageTestModel(Long id, String title, String content) {
			this();
			this.id = id;
			this.title = title;
			this.content = content;
		}
	}
}
